package 楼兰图腾;

import java.util.*;

public class Main {
    static int N = 200010, n;
    static int[] a = new int[N], tr = new int[N];// tr树状数组
    static int[] up = new int[N], down = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 1; i <= n; i++) {
            int y = a[i];
            up[i] = sum(n) - sum(y);
            down[i] = sum(y - 1);
            add(y, 1);
        }
        Arrays.fill(tr, 0);
        long res1 = 0, res2 = 0;
        for (int i = n; i >= 1; i--) {
            int y = a[i];
            res1 += (long) up[i] * (sum(n) - sum(y));
            res2 += (long) down[i] * sum(y - 1);
            add(y,1);
        }
        System.out.println(res1+" "+res2);
    }

    private static int sum(int x) {
        int ret = 0;
        for (int i = x; i >= 1; i -= lowbit(i)) {
            ret += tr[i];
        }
        return ret;
    }

    private static void add(int x, int c) {
        for (int i = x; i <= n; i += lowbit(i)) {
            tr[i] += c;
        }
    }

    private static int lowbit(int x) {
        return x & -x;
    }
}
